package org.heart.springsecurity.springSecurity;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.List;

public class AuthenticationUserDetails implements UserDetails {
    private int userId;
    private String username;
    private String password;
    private List<GrantedAuthority> authorities;

    public int getUserId() {
        return userId;
    }

    public AuthenticationUserDetails setUserId(int userId) {
        this.userId = userId;
        return this;
    }

    @Override
    public String getUsername() {
        return username;
    }

    public AuthenticationUserDetails setUsername(String username) {
        this.username = username;
        return this;
    }

    @Override
    public String getPassword() {
        return password;
    }

    public AuthenticationUserDetails setPassword(String password) {
        this.password = password;
        return this;
    }

    @Override
    public List<GrantedAuthority> getAuthorities() {
        return authorities;
    }

    public AuthenticationUserDetails setAuthorities(List<GrantedAuthority> authorities) {
        this.authorities = authorities;
        return this;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }


    @Override
    public String toString() {
        return "AuthenticationUserDetails{" +
                "userId=" + userId +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", authorities=" + authorities +
                '}';
    }


}
